<template>
  <div>
    <h3>女人组件</h3>

    <div>私房钱：{{ money }}</div>
    <div>金钱：{{ num }}</div>
    <button @click="buyLipAsync(10)">买口红-10</button>
  </div>
</template>

<script>
import { mapActions, mapState } from "vuex";
export default {
  data() {
    return {
      n1: 10,
      n2: 10,
    };
  },
  computed: {
    money() {
      return this.n1 + this.n2;
    },
    ...mapState({
      num: "money",
    }),
  },
  methods: {
    // buyLipFn() {
    //   this.$store.dispatch("buyLipAsync", 10);
    // },
    ...mapActions(["buyLipAsync"]),
  },
};
</script>

<style></style>
